import 'package:gluz/generated/json/base/json_convert_content.dart';
import 'package:gluz/app/data/user_vip_entity.dart';

UserVipEntity $UserVipEntityFromJson(Map<String, dynamic> json) {
  final UserVipEntity userVipEntity = UserVipEntity();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    userVipEntity.id = id;
  }
  final String? userId = jsonConvert.convert<String>(json['userId']);
  if (userId != null) {
    userVipEntity.userId = userId;
  }
  final String? level = jsonConvert.convert<String>(json['level']);
  if (level != null) {
    userVipEntity.level = level;
  }
  final int? score = jsonConvert.convert<int>(json['score']);
  if (score != null) {
    userVipEntity.score = score;
  }
  final int? remainDays = jsonConvert.convert<int>(json['remainDays']);
  if (remainDays != null) {
    userVipEntity.remainDays = remainDays;
  }
  return userVipEntity;
}

Map<String, dynamic> $UserVipEntityToJson(UserVipEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['userId'] = entity.userId;
  data['level'] = entity.level;
  data['score'] = entity.score;
  data['remainDays'] = entity.remainDays;
  return data;
}

extension UserVipEntityExtension on UserVipEntity {
  UserVipEntity copyWith({
    String? id,
    String? userId,
    String? level,
    int? score,
    int? remainDays,
  }) {
    return UserVipEntity()
      ..id = id ?? this.id
      ..userId = userId ?? this.userId
      ..level = level ?? this.level
      ..score = score ?? this.score
      ..remainDays = remainDays ?? this.remainDays;
  }
}